﻿using InstallWizard.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace InstallWizard
{
    public partial class MainPanel : Form
    {

        Form[] pages = new Form[4];

        string configFile = "wizard.config";

        public MainPanel()
        {
            InitializeComponent();
        }

        private void MainPanel_Load(object sender, EventArgs e)
        {
            AppInfo appInfo = DAL.FileIO.ReadConfigFile(configFile, out List<AppFileInfo> appFileList);
            Text = $"{appInfo.AppName} {appInfo.AppVer} 安装向导";
            //创建Page1
            pages[0] = new Page1
            {
                TopLevel = false,
                FormBorderStyle = FormBorderStyle.None,
                Dock = DockStyle.Fill,
                Tag=pages//把页面清单给到每个页面，以供调用
            };

            //创建Page2
            pages[1] = new Page2
            {
                TopLevel = false,
                FormBorderStyle = FormBorderStyle.None,
                Dock = DockStyle.Fill,
                Tag = pages
            };
            //创建Page3
            pages[2] = new Page3
            {
                TopLevel = false,
                FormBorderStyle = FormBorderStyle.None,
                Dock = DockStyle.Fill,
                Tag = pages
            };
            //创建Page4
            pages[3] = new Page4
            {
                TopLevel = false,
                FormBorderStyle = FormBorderStyle.None,
                Dock = DockStyle.Fill,
                Tag = pages
            };

            panel1.Controls.Clear();
            panel1.Controls.AddRange(pages);
            pages[0].Show();
        }

    }
}
